package org.web.daotest;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.web.ssm.dao.ProductMapMapper;
import org.web.ssm.dao.ProductMapper;
import org.web.ssm.dao.UserMapper;
import org.web.ssm.model.Product;
import org.web.ssm.model.ProductMap;
import org.web.ssm.model.User;
import org.web.ssm.model.UserProductInfoView;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * Created by LUOLIANG on 2016/6/22.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:configs/spring-mybatis.xml"})
public class productmapdaotest {
    @Autowired
    private ProductMapMapper productMapMapper;
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private ProductMapper productMapper;

    @Test
    public void testquery() {
//        Product product = productMapper.selectByPrimarykey("8");
//        System.out.println(product);
//        User user = userMapper.selectByPrimaryKey("23");
//        ProductMap productMap = new ProductMap(5000d, new Date(), new Date(), product, user);
//        int res = productMapMapper.insertProductMap(productMap);
//        List<ProductMap> list = productMapMapper.selectByUser("23", "");
//        System.out.println(list);
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        date = calendar.getTime();
        System.out.println(date);
    }
}
